package com.strato.mvc.enhance.defaults.v1_0_0.enhancer;

import java.lang.ref.WeakReference;
import java.util.Map;

import org.osgi.framework.BundleContext;

import com.strato.annotation.base.v1_0_0.lifecycle.BundleContextAware;
import com.strato.annotation.osgi.v1_0_0.service.OsgiService;
import com.strato.base.env.v1_0_0.GlobalEnvironment;
import com.strato.mvc.api.v1_0_0.view.ModelEnhancer;

@OsgiService
public class DefaultModelEnhancer implements ModelEnhancer,BundleContextAware {

	private WeakReference<BundleContext> context;

	@Override
	public void enhance(Map<Object, Object> model) {
		model.put("osgi", context.get());
		model.put("env", GlobalEnvironment.getInstance());
	}

	@Override
	public void setBundleContext(WeakReference<BundleContext> context) {
		this.context=context;
	}

}
